package com.itheima.aspect;

import com.itheima.entity.OperateLog;
import com.itheima.mapper.OperateLogMapper;
import com.itheima.util.JwtUtils;
import io.jsonwebtoken.Claims;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.util.Arrays;

@Component
//@Aspect
public class OperationLogAspect {
    @Autowired
    OperateLogMapper operateLogMapper;

    @Autowired
    HttpServletRequest request;

    @Around("@annotation(com.itheima.annotation.MyLog)")
    public Object recordOperationlog(ProceedingJoinPoint pjp) throws Throwable {
        Long start = System.currentTimeMillis();
        Object result = pjp.proceed();
        Long end = System.currentTimeMillis();
        // 向日志表中添加一条日志操作
       pjp.proceed().getClass().desiredAssertionStatus();

        //operateLogMapper.insert(operateLog);

        return result;
    }
}
